<template>
  <div>
      <mu-container>
          <mu-card style="width: 100%; margin: 0 auto;" v-for="item in lists" >
              <mu-card-header :title="item.employ_name" :sub-title="'预算￥：'+item.fee">
                  <mu-avatar slot="avatar">
                      <img :src="item.employ_avatar" :onerror="img_error">
                  </mu-avatar>
              </mu-card-header>

              <a :href="'#/purchase/show?id='+item.id">
              <mu-card-text v-html="item.name">  </mu-card-text>
              <mu-card-text>
                  <div class="mu-card-media"  v-if="item.image[0]">
                      <img  :src="item.image[0]" alt=""  >
                  </div>
              </mu-card-text>
              <mu-card-text v-html="item.content">  </mu-card-text>
              </a>

          </mu-card>
          <p style="height:50px"></p>
      </mu-container>
      <toolbar :value="'demand'"></toolbar>
  </div>
</template>

<script>
    import toolbar from "@/view/common/toolbar"

    export default {
        name: 'demand',
        data () {
            return {
                icon:{
                    zan:require("@/img/icon/zan.png"),
                    msg:require("@/img/icon/msg.png"),
                },
                lists:[],
                img_error:"this.src='"+require("@/img/logo.png")+"'",
                msg: 'Welcome to Your Vue.js App'
            }
        },
        mounted(){
            this.load_lists();
        },
        methods:{
            load_lists(){
                let $this = this;
                let param = {};
                if(this.$route.query.employ_id){
                    param["employ_id"] = this.$route.query.employ_id;
                }
                this.$api.employ_purchase(param,function(resp){
                    if(resp.code == 0){
                        $this.lists = resp.data.data;
                        console.log($this.lists );
                    }else{
                        this.$toast.error(resp,msg);
                    }
                });
            }
        },
        components:{
            toolbar
        }
    }
</script>

